﻿using System;
using System.Collections.Generic;
using System.Drawing;
using Emgu.CV;
using Emgu.CV.Structure;

namespace WpfFaceDetectionTest
{
    public static class VideoUtils
    {
        public static IEnumerable<Image<Bgr, Byte>> GetVideoFrames(string path)
        {
            Capture _capture = new Capture(path);

            bool notEmpty = true;

            while (notEmpty)
            {
                Image<Bgr, Byte> frame = _capture.QueryFrame();
                if (frame != null)
                    yield return frame.Copy();
                else
                    notEmpty = false;
            }
        }
    }
}
